<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	
	<p:dialog id="role_edit_dialog" widgetVar="role_edit_var" modal="true"
		header="#{roleBean.model eq comm.m_a ? msgs.btnNew :(roleBean.model eq comm.m_q ? msgs.btnQuery : (roleBean.model eq comm.m_m ? msgs.btnEdit : (roleBean.model eq comm.m_r ? msgs.btnRemove : '')))}角色信息" resizable="false" width="500">

		<h:form prependId="false" id="role_edit_form">
			<p:focus context="role_edit_form"/>
			
			<h:panelGrid columns="4" columnClasses="column1,column2,column1,column2">
				<h:outputText value="编码：" />
				<h:column>
					<p:inputText value="#{roleBean.instance.code}" maxlength="50"
						disabled="#{roleBean.model eq comm.m_q}" label="编码：">
						<f:validator validatorId="validator" />
						<f:attribute name="req_trim" value="true"/>
						<f:attribute name="req_notnull" value="true" />
						<f:attribute name="max_length" value="50"/>
					</p:inputText>
					<h:outputText value="*" style="color: red;" />
				</h:column>
				<h:outputText value="名称：" />
				<h:column>
					<p:inputText value="#{roleBean.instance.name}" maxlength="50"
						disabled="#{roleBean.model eq comm.m_q}" label="名称：">
						<f:validator validatorId="validator" />
						<f:attribute name="req_trim" value="true"/>
						<f:attribute name="req_notnull" value="true" />
						<f:attribute name="max_length" value="50"/>
					</p:inputText>
					<h:outputText value="*" style="color: red;" />
				</h:column>
			</h:panelGrid>
			
			<h:panelGrid columns="2" columnClasses="column1">
				<h:outputText value="备注：" />
				<p:inputTextarea value="#{roleBean.instance.remarks}" style="width: 362px; height: 50px;"
					autoResize="true" disabled="#{roleBean.model eq comm.m_q}" label="备注：" maxlength="255">
				</p:inputTextarea>
				
				<h:outputText value="#{msgs.valid}：" />
				<h:selectOneRadio value="#{roleBean.instance.status}" disabled="#{roleBean.model eq comm.m_q}" label="#{msgs.valid}：">
					<f:selectItem itemLabel="#{msgs.valid_y}" itemValue="1"/>
					<f:selectItem itemLabel="#{msgs.valid_n}" itemValue="1024"/>
				</h:selectOneRadio>
			</h:panelGrid>
			<div style="text-align: center;">
				<p:commandButton icon="#{comm.saveClass}" value="#{msgs.btnSave}" action="#{roleBean.doAction}"
					oncomplete="handleRole(xhr, status, args);" update=":option_info"
					disabled="#{roleBean.model eq comm.m_q}"/>
				<p:commandButton icon="#{comm.cancelClass}" value="#{msgs.btnCancel}" 
					type="button" onclick="role_edit_var.hide();"/>
			</div>
		</h:form>
		<script type="text/javascript">
			function handleRole(xhr, status, args) {
				if(args.option_result == 'success') {
					role_edit_var.hide();
				}
			}
		</script>
	</p:dialog>

</ui:composition>